package dlwntk6545.swing;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;

public class SwingPopMenu extends JPopupMenu{
	
	private JPopupMenu popup = null;
	
	
	
	public SwingPopMenu(JPanel p){
		popup = new JPopupMenu();
		//SwingPopMenu popupMenu = new SwingPopMenu();
		
		JMenuItem m1 = new JMenuItem("new");
		popup.add(m1);
		makePopmenu();
		makeMenu();
		addPopmenu();
		p.addMouseListener(new PopupMenuListener());
		
		
	}
	
	private void makePopmenu() {
		// TODO Auto-generated method stub
		
	}
	
	private void makeMenu() {
		// TODO Auto-generated method stub
		
	}
	
	private void addPopmenu() {
		// TODO Auto-generated method stub
		
	}
	
	class PopupMenuListener extends MouseAdapter{
		private JPopupMenu popup = null;
		
		@Override
		public void mousePressed(MouseEvent e) {
			
			super.mousePressed(e);
			
		}
		
		@Override
		public void mouseReleased(MouseEvent e) {
			
			super.mouseReleased(e);
			
		}
		private void showMenu(MouseEvent e){
			
			popup.show(e.getComponent(), e.getX(), e.getY());
			
		}
		
	}
	
}
